package cc.fs.study.market;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.mcxiaoke.packer.helper.PackerNg;

import cc.fs.study.R;

/**
 * 打包demo
 * 这段代码:直接运行会有问题,需要在命令行执行命令后才可以正确打包
 * 需要在根目录下:命令行输入 -> ./gradlew -Pmarket=markets.txt clean apkRelease
 * 网址:https://github.com/mcxiaoke/packer-ng-plugin
 */

public class MarketActivity extends AppCompatActivity {

    TextView tv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_market);

        tv = (TextView)findViewById(R.id.txt);

        findViewById(R.id.btn).setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        String market = PackerNg.getMarket(getApplicationContext());
                        tv.setText("渠道号"+market);
                    }
                }
        );

    }
}
